import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Icon } from 'antd';
import { requestPosts } from '../../actions';
import MovieCustom from '../../components/MovieCustom';


class MovieList extends Component {
    constructor(props){
        super(props);
        this.state = {
            data: [
                { 
                    images: "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p480747492.webp", 
                    title: "肖申克的救赎", 
                    directors: ["弗兰克·德拉邦特"], 
                    casts: ["鲍勃·冈顿", "摩根·弗里曼", "蒂姆·罗宾斯"], 
                    year: "1994", 
                    genres: [ "犯罪", "剧情" ], 
                    collect_count: "1712396", 
                    id: "1292052" 
                },
            ]
        }
    }
    render() {
        console.log("传递进来的属性：", this.props);
        return (
            <div>
                <div>
                    { this.props.isFetching ? <Icon type="loading" /> : '' }
                </div>
                <MovieCustom data={this.state.data} />
            </div>
        )
    }
}

const mapStateToProps = (state) => {
    return {
        isFetching: state.visity.isFetching
    }
}

const mapDispathToProps = (dispatch) => {
    return {
        
    }
}

export default connect(mapStateToProps)(MovieList);